import 'package:flutter/material.dart';
import 'package:cached_network_image/cached_network_image.dart';

class DiscoverFrame extends StatefulWidget {
  const DiscoverFrame({Key? key}) : super(key: key);

  @override
  State<DiscoverFrame> createState() => _DiscoverFrameState();
}

class _DiscoverFrameState extends State<DiscoverFrame> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.grey.shade100,
      appBar: PreferredSize(
        preferredSize: const Size.fromHeight(35.0),
        child: AppBar(
          elevation: 0,
          backgroundColor: Colors.grey.shade100,
          title: Text("发现", style: TextStyle(color: Colors.black)),
        ),
      ),
      body: Column(
        children: [
          Container(
            padding: EdgeInsets.symmetric(horizontal: 12),
            height: 45,
            color: Colors.white,
            child: Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: [
                Row(
                  mainAxisSize: MainAxisSize.min,
                  children: [
                    Image.asset("asset/discover/朋友圈.png",
                        width: 20, height: 20),
                    SizedBox(width: 10),
                    Text(
                      "朋友圈",
                      style: TextStyle(fontSize: 17),
                    )
                  ],
                ),
                Row(
                  mainAxisSize: MainAxisSize.min,
                  children: [
                    Stack(
                      children: [
                        ClipRRect(
                          borderRadius: BorderRadius.circular(3),
                          child: Container(
                            width: 30,
                            height: 30,
                            child: CachedNetworkImage(
                              imageUrl:
                                  "https://img2.baidu.com/it/u=2421090168,324781765&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500",
                              placeholder: (context, url) =>
                                  Container(color: Colors.grey.shade400),
                              errorWidget: (context, url, error) =>
                                  Icon(Icons.error),
                            ),
                          ),
                        ),
                        Positioned(
                            top: 0,
                            right: 0,
                            child: Container(
                              width: 8,
                              height: 8,
                              decoration: BoxDecoration(
                                  shape: BoxShape.circle, color: Colors.red),
                            ))
                      ],
                    ),
                    Icon(
                      Icons.keyboard_arrow_right,
                      color: Colors.grey.shade400,
                    )
                  ],
                )
              ],
            ),
          ),
        ],
      ),
    );
  }
}
